package com.ruoyi.farm.biz.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.farm.biz.mapper.CattleMapper;
import com.ruoyi.farm.biz.service.ICattleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.farm.api.domain.Cattle;

/**
 * 牛只Service业务层处理
 * 
 * @author Andy
 * @date 2022-07-25
 */
@Service
public class CattleServiceImpl implements ICattleService
{
    @Autowired
    private CattleMapper cattleMapper;

    /**
     * 查询牛只
     * 
     * @param id 牛只主键
     * @return 牛只
     */
    @Override
    public Cattle selectCattleById(Long id)
    {
        return cattleMapper.selectCattleById(id);
    }

    /**
     * 查询牛只列表
     * 
     * @param cattle 牛只
     * @return 牛只
     */
    @Override
    public List<Cattle> selectCattleList(Cattle cattle)
    {
        return cattleMapper.selectCattleList(cattle);
    }

    /**
     * 新增牛只
     * 
     * @param cattle 牛只
     * @return 结果
     */
    @Override
    public int insertCattle(Cattle cattle)
    {
        cattle.setCreateTime(DateUtils.getNowDate());
        return cattleMapper.insertCattle(cattle);
    }

    /**
     * 修改牛只
     * 
     * @param cattle 牛只
     * @return 结果
     */
    @Override
    public int updateCattle(Cattle cattle)
    {
        cattle.setUpdateTime(DateUtils.getNowDate());
        return cattleMapper.updateCattle(cattle);
    }

    /**
     * 批量删除牛只
     * 
     * @param ids 需要删除的牛只主键
     * @return 结果
     */
    @Override
    public int deleteCattleByIds(Long[] ids)
    {
        return cattleMapper.deleteCattleByIds(ids);
    }

    /**
     * 删除牛只信息
     * 
     * @param id 牛只主键
     * @return 结果
     */
    @Override
    public int deleteCattleById(Long id)
    {
        return cattleMapper.deleteCattleById(id);
    }
}
